package day05;
import javafx.util.converter.IntegerStringConverter;
import sun.java2d.pipe.SpanIterator;

import java.util.Arrays;
import  java.util.Scanner;
public class homework {
    public static void main(String[] args) {
        /*
        Scanner scan = new Scanner(System.in);
        int score=0;
        for (int i=1;i<=10;i++){
            int a =(int) (Math.random()*100);
            int b =(int) (Math.random()*100);
            int result=a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧！");
            int answer=scan.nextInt();
            if (answer==result){
                System.out.println("答对了");
                score+=10;
            }else {
                System.out.println("打错了");
            }
        }
        System.out.println("总分为："+score);
         */

        /*
        for (int num=1;num<=9;num++){
            for (int i=1;i<=num;i++){
                System.out.println(i+"*"+num+"+"+i*num+"\t");
            }
            System.out.println();
        }
        */

        /*
        int[] arr=new int[10];
        int[] ace=new int[15];
        */

        /*
        int []arr1=new int[3];
        int[] arr2={2,5,8};
        int[] arr3=new int[]{2,5,8};
        int[] arr4;
        arr4 = new int[]{2,5,8};
        */

        /*
        int[]arr=new int[3];
        System.out.println(arr.length);
        arr[0]=100;
        arr[1]=200;
        arr[2]=300;
        System.out.println(arr[arr.length-1]);
        ArrayIndexOutOfBoundsException
         */

        /*
        int[]arr=new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
         */

        /*
        int[] arr=new int[10];
        for (int i=0;i<arr.length;i++) {
            arr[i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        int max =arr[0];
        for (int i=1;i<arr.length;i++){
            if (arr[i]>max){
                max=arr[i];
            }
        }
        System.out.println("最大值为："+max);
        */

        /*
        int[]arr=new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);

        System.out.println("排序后");
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("倒着输出");
        for (int i=arr.length-1;i>0;i--){
            System.out.println(arr[i]);
        }
        System.out.println("第一个元素为："+arr[0]);
        */

        /*
        Scanner sec=new Scanner(System.in);
        int af=0;
        for (int o=1;o<=10;o++){
            int a = (int)(Math.random()*100);
            int b = (int) (Math.random()*100);
            int sou=a+b;
            System.out.println("("+o+")"+a+"+"+b+"=?");
            System.out.println("算吧！");
            int hi=sec.nextInt();
            if (hi==sou){
                System.out.println("答对了");
                af+=10;
            }else{
                System.out.println("答对了");
            }
        }
        System.out.println("总分为："+af);
        */

        /*
        for (int n=1;n<=9;n++){
            for (int s=1;s<n;s++){
                System.out.println(s+"*"+n+"="+s*n+"\t");
            }
            System.out.println();
        }
         */

        /*
        int[]op =new int[10];
        int[]po=new int[3];
        int[]oi={2,5,8};
        int[]iu = new int [] {2,5,8};
        int[] rt;
        rt =new int[]{3,6,9};
        */
        /*
        int[] vb=new int[5];
        System.out.println(vb.length);
        vb[0]=100;
        vb[1]=200;
        vb[2]=300;
        System.out.println(vb[vb.length-1]);

        int[]cx=new int[10];
        for (int i=0;i<cx.length;i++){
            cx[i]=(int) (Math.random()*100);
            System.out.println(cx[i]);
        }

        int[] xz=new int[10];
        for (int d=0;d<xz.length;d++){
            xz[d]=(int) (Math.random()*100);
            System.out.println(xz[d]);
        }
        int mi=xz[0];
        for (int d=1;d<xz.length;d++){
            if (xz[d]>mi){
                mi=xz[d];
            }
        }
        System.out.println("最大值为："+mi);
        */
        /*
        int[] rt=new int[10];
        for (int r=0;r<rt.length;r++){
            rt[r]=(int) (Math.random()*100);
            System.out.println(rt[r]);
        }
        Arrays.sort(rt);
        System.out.println("排序后");
        for (int r=0;r<rt.length;r++){
            System.out.println(rt[r]);
        }
        System.out.println("倒着输出");
        for (int r=rt.length;r>=0;r--){
            System.out.println(rt[r]);
        }
        System.out.println("第一个元素为："+rt[0]);
        
         */











    }
}
